home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / PowerTalk Access Modules / Sample SMSAM / SampleSMSAM Source / VirtualFile / VirtualFolder.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-28  |  2.9 KB  |  101 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        VirtualFolder.h
  3.  
  4.     Copyright:    © 1991-1994 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Part of the AOCE Sample SMSAM Package.  Consult the license
  8.     which came with this software for your specific legal rights.
  9.  
  10. */
  11.  
  12.  
  13.  
  14. #ifndef __VIRTUALFOLDER__
  15. #define __VIRTUALFOLDER__
  16.  
  17. #ifndef __HANDLEOBJECT__
  18. #include "HandleObject.h"
  19. #endif
  20.  
  21. #ifndef __OBJECTLIST__
  22. #include "ObjectList.h"
  23. #endif
  24.  
  25. #ifndef __VIRTUALMACFILE__
  26. #include "VirtualMacFile.h"
  27. #endif
  28.  
  29. #ifndef    __FILES__
  30. #include <Files.h>
  31. #endif
  32.  
  33. #pragma push
  34. #pragma segment VirtualFolder
  35.  
  36. class TMacFileList;
  37. class TFolderList;
  38.  
  39. /***********************************|****************************************/
  40.  
  41. class TVirtualFolder : public THandleObject 
  42. {
  43. public:        TVirtualFolder ( const Str255 fileName );
  44.             TVirtualFolder ( const char* fileName );
  45.             TVirtualFolder ( const FSSpec&, Boolean mimicActualHFS = false );
  46.             
  47.     virtual    ~TVirtualFolder();
  48.  
  49.             unsigned long             FileCount() const; 
  50.             unsigned long             FolderCount() const;
  51.             unsigned long             TotalSize() const;
  52.  
  53.             OSErr                     AddFile(TVirtualMacFile* );
  54.             void                     RemoveFile(TVirtualMacFile* );
  55.  
  56.             OSErr                     AddFolder(TVirtualFolder* );
  57.             void                     RemoveFolder(TVirtualFolder* );
  58.  
  59.             TVirtualMacFile*         GetIndexFile(unsigned long index) const; 
  60.             TVirtualFolder*         GetIndexFolder(unsigned long index) const;
  61.  
  62.             void                     SetFolderName(const Str255 folderName );
  63.             void                     SetFolderName(const char* folderName );
  64.             void                     GetFolderName(Str255 folderName ) const;
  65.  
  66.             OSErr                     SetFinderInfo (const FInfo& );
  67.             OSErr                     GetFinderInfo (FInfo& ) const;
  68.     
  69.             OSErr                     GetDate (unsigned long& dateTime,TVirtualMacFile::WhichDateType whichDate) const;
  70.             OSErr                     SetDate (unsigned long dateTime,TVirtualMacFile::WhichDateType whichDate);
  71.  
  72.             OSErr                     WriteToDisk ( short vRefNum, long parID );
  73.             OSErr                     WriteContentsToDisk ( short vRefNum, long parID );
  74.     
  75. protected:    void                    InheritDown ( const FSSpec& fileSpec );
  76.             Boolean                    IsFileFolderNameUnique(const StringPtr ) const;
  77.             
  78.             FSSpec                    fSpec;
  79.             TMacFileList*             fFileList;
  80.             TFolderList*             fFolderList;
  81. };
  82.  
  83. /***********************************|****************************************/
  84.  
  85. DeclareList ( TVirtualMacFile, TMacFileList );
  86. DeclareList ( TVirtualFolder, TFolderList );
  87.  
  88. inline unsigned long  TVirtualFolder::FileCount() const { return fFileList->Count(); }
  89. inline unsigned long TVirtualFolder::FolderCount() const { return fFolderList->Count(); }
  90. inline void TVirtualFolder::RemoveFile(TVirtualMacFile* aFile) { fFileList->Remove(aFile); }
  91. inline void TVirtualFolder::RemoveFolder(TVirtualFolder* aFolder) { fFolderList->Remove(aFolder); }
  92. inline TVirtualFolder* TVirtualFolder::GetIndexFolder(unsigned long index) const{return fFolderList->Get(index);}
  93. inline TVirtualMacFile* TVirtualFolder::GetIndexFile(unsigned long index) const{return fFileList->Get(index);}
  94.  
  95. /***********************************|****************************************/
  96.  
  97. #pragma pop
  98.  
  99. #endif    // __VIRTUALFOLDER__
  100.  
  101.